import axios from 'axios'
import * as constants  from './constants'


const detailList = (data) =>({
  type:constants.DETAIL_LIST,
  title:data.title,
  content:data.content
})

export const getDetailInfo = (id) =>{
  return (dispatch) => {
    axios.get('/api/detail.json?id='+id).then((resp) => {
      debugger;
      if (resp.data.success) {
        console.log(resp.data)
        dispatch(detailList(resp.data))
      }
    }).catch((e) => {
      alert('数据请求失败请重试')
      console.log(e)  
    })
  }
}